package com.spzx.test.t5;

import lombok.SneakyThrows;
import org.apache.commons.lang3.RandomUtils;

import java.util.concurrent.TimeUnit;

public class Phone {

    @SneakyThrows
    public  synchronized void call(){
        System.out.println(Thread.currentThread().getName()+"正在打电话");
        TimeUnit.SECONDS.sleep(RandomUtils.nextInt(11,50));
        System.out.println(Thread.currentThread().getName()+"打完电话");
    }

    @SneakyThrows
    public  synchronized void sendMsg(){
        System.out.println(Thread.currentThread().getName()+"正在发短信");
        TimeUnit.SECONDS.sleep(RandomUtils.nextInt(10,50));
        System.out.println(Thread.currentThread().getName()+"发完短信");
    }


}
